#include "../../../xcom/xall.hpp"

int main(int argc, char* argv[])
{
    _xxx_printf = false;
    xsock s;
    bool ret = s.tcp_create();
    X_CHECK(ret,-1);

    s.xbind("127.0.0.1",8888);
    sleep_ns((uint64_t)5*1000*1000*1000);

    while (1)
    {
        ret = s.connect("127.0.0.1", 6666);
        if (ret)
        {
            auto peer = s.get_peer_addr();
            auto local = s.get_local_addr();
            printf("connected！peer=%s,local=%s\n",
                   get_addr_str(&peer).c_str(),
                   get_addr_str(&local).c_str());
            sleep_ns((uint64_t)200 * 1000 * 1000 * 1000);
        }
    }

    return 0;
}